'use strict'


import Http from '../kit/HttpKit'
import Api from './Api'

const URL_LIST_MEMBER = Api.API_URL + '/news/listOfMember'
const URL_LIST_COMPANY = Api.API_URL + '/news/listOfCompany'
const URL_LIST_COMMERCE = Api.API_URL + '/news/listOfCommerce'
const URL_CHECK_STATUS_PASS = Api.API_URL + '/news/checkStatusPass'
const URL_CHECK_STATUS_FAIL = Api.API_URL + '/news/checkStatusFail'

const URL_DELETE = Api.API_URL + '/news/delete'

/**
* 风采管理模块
**/
const listOfMember = (data, callback)=>{
	var url = Api.API_URL + '/news/listOfMember';

	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}

const detailOfMember = (newsId, callback)=>{
	var url = Api.API_URL + '/news/detailOfMember';

	let data = {id: newsId};
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}

const listOfCompany = (data, callback)=>{
	var url = Api.API_URL + '/news/listOfCompany';

	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}

const detailOfCompany = (newsId, callback)=>{
	var url = Api.API_URL + '/news/detailOfCompany';

	let data = {id: newsId};
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}

const listOfCommerce = (data, callback)=>{
	var url = Api.API_URL + '/news/listOfCommerce';

	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}

const detailOfCommerce = (newsId, callback)=>{
	var url = Api.API_URL + '/news/detailOfCommerce';

	let data = {id: newsId};
	data.api_token = Api.getApiToken();
	data.api_user_id = Api.getApiUserId();

	Http.post(url, data, json=>{
		Api.getDataCB(json, callback);
	});
}

export default{
	listOfMember, listOfCompany, listOfCommerce,
	detailOfMember, detailOfCompany, detailOfCommerce, 
	URL_LIST_MEMBER, URL_LIST_COMPANY, URL_LIST_COMMERCE, URL_DELETE,
	URL_CHECK_STATUS_PASS, URL_CHECK_STATUS_FAIL
}
